package com.yzk.train.business.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

@Getter
@AllArgsConstructor
public enum SeatColEnum {

    TDZ_A("A", "A", "1"),
    TDZ_C("C", "C", "1"),
    TDZ_D("D", "D", "1"),
    TDZ_F("F", "F", "1"),
    YDZ_A("A", "A", "2"),
    YDZ_C("C", "C", "2"),
    YDZ_D("D", "D", "2"),
    YDZ_F("F", "F", "2"),
    EDZ_A("A", "A", "3"),
    EDZ_B("B", "B", "3"),
    EDZ_C("C", "C", "3"),
    EDZ_D("D", "D", "3"),
    EDZ_F("F", "F", "3");

    private String code;

    private String desc;

    /**
     * 对应SeatTypeEnum.code
     */
    private String type;

    /**
     * 根据车箱的座位类型，筛选出所有的列，比如车箱类型是一等座，则筛选出columnList={ACDF}
     */
    public static List<SeatColEnum> getColsByType(String seatType) {
        List<SeatColEnum> colList = new ArrayList<>();
        EnumSet<SeatColEnum> seatColEnums = EnumSet.allOf(SeatColEnum.class);
        for (SeatColEnum anEnum : seatColEnums) {
            if (seatType.equals(anEnum.getType())) {
                colList.add(anEnum);
            }
        }
        return colList;
    }

}
